package io.jnet.common.readprocessor;

import com.jfireframework.baseutil.collection.buffer.ByteBuf;
import io.jnet.common.api.ChannelContext;
import io.jnet.common.api.ReadProcessor;
import io.jnet.common.bufstorage.BufStorage;
import io.jnet.common.businessprocessor.MutlisAttachProcessor;
import io.jnet.common.streamprocessor.ProcessorTask;
import io.jnet.common.streamprocessor.StreamProcessor;

public class MutliAttachReadHandler implements ReadProcessor
{
    private final MutlisAttachProcessor processor;
    
    public MutliAttachReadHandler(MutlisAttachProcessor processor)
    {
        this.processor = processor;
    }
    
    @Override
    public void process(ByteBuf<?> buf, BufStorage bufStorage, StreamProcessor[] inProcessors, ChannelContext channelContext) throws Throwable
    {
        ProcessorTask task = new ProcessorTask(buf, 0, channelContext);
        processor.commit(task);
    }
    
}
